package com.zbkj.crmeb.test.task;

import com.constants.SmsConstants;
import com.zbkj.crmeb.enums.BusinessCodeEnum;
import com.zbkj.crmeb.store.service.StoreOrderService;
import com.zbkj.crmeb.system.model.MessageConfig;
import com.zbkj.crmeb.system.model.Notice;
import com.zbkj.crmeb.system.service.MessageConfigService;
import com.zbkj.crmeb.system.service.NoticeService;
import com.zbkj.crmeb.task.plat.poizon.PoizonApi;
import com.zbkj.crmeb.task.plat.poizon.PoizonOrderTask;
import com.zbkj.crmeb.task.plat.poizon.PoizonProductTask;
import com.zbkj.crmeb.test.BaseTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Zhangxuyang
 * @date 4/28/2024 2:08 下午
 */
public class PoizonTask extends BaseTest {

    @Autowired
    PoizonProductTask poizonProductTask;
    @Autowired
    PoizonOrderTask poizonOrderTask;
    @Autowired
    PoizonApi poizonApi;
    @Autowired
    NoticeService noticeService;
    @Autowired
    MessageConfigService messageConfigService;


    @Test
    public void addMessageConfig() throws Exception {
        MessageConfig config = new MessageConfig();
        config.setMerId(1);
        messageConfigService.addOrUpdate(config);
    }
    @Test
    public void sendMessage() throws Exception {
        messageConfigService.sendMessage(1, BusinessCodeEnum.MERCHANT_ACCOUNT_WARN.getCode(), SmsConstants.SMS_WARNING_TEMPLATE_ID, SmsConstants.SMS_TEST_CONTENT);
    }
    @Test
    public void sendWarningMessage() throws Exception {
        messageConfigService.sendWarningMessage(1);
    }
    @Test
    public void addNotice() throws Exception {
        Notice notice = new Notice();
        notice.setMerId(1);
        noticeService.add(notice);
    }

    @Test
    public void checkAndUpdateToken() throws Exception {
        poizonApi.checkAndUpdateToken();
    }

    @Test
    public void fetch() throws Exception {
        poizonOrderTask.fetch();
    }
    @Test
    public void pushProduct2DW() throws Exception {
//        TaskProcessEngineFactory.executeTask();
    }
    @Test
    public void checkPrice() throws Exception {
//        poizonProductTask.checkByProductPriceV2();
//        poizonProductTask.checkByProductStockV2();
    }

    @Autowired
    StoreOrderService storeOrderService;
    @Test
    public void getOrder() {
//        poizonOrderTask.fetch();
//        PushOrderRequest pushOrderRequest = new PushOrderRequest();
//        SystemAdmin systemAdmin = new SystemAdmin();
//        storeOrderService.pushOrder(pushOrderRequest,"127.0.0.1", systemAdmin);
    }
}
